package demo3;

public class Test {
    public static void eat2(Animal am){
        am.eat();
    }
    public static void fly1(Fly bd){
        bd.fly();
    }
    public static void run(Running rn){
        rn.running();
    }
    public static void sw(Swimming sw2){
        sw2.swimming();
    }
    public static void et(Machine ma){
        ma.electricity();
    }
    public static void main(String [] args){
        eat2(new Dog("咪咪",2,"老抽色","雌"));
        eat2(new BigFish("哈哈",1,"雄"));
        eat2(new Duck("发发",3,"白色","雄"));
        et(new Machine("中华"));
        fly1(new Machine("追梦"));
        run(new Dog("可可",2,"米色","雄"));
        run(new Duck("急急急",2,"黄色","雄"));
        sw(new BigFish("咕咕",2,"黄色"));
        sw(new Dog("塔塔",1,"彩色","雌"));
        Dog dog1=new Dog("糊糊",1,"黄色","雄");
        Dog dog2=new Dog("绵绵",2,"白色","雌");
        System.out.println(dog1==dog2);
        System.out.println(dog1.equals(dog2));
        System.out.println(dog1.equals(dog1));
        System.out.println("======");
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());

    }
}
